<?php
session_start();
?>
<html>
<head>


<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="pupdate.js"></script>

</head>

<body bgcolor="#FFFFFF">
<p>
  <?php      

include("../../MerchandiseBay/conn.php");

//$reservationdate="";
//$kind="";
//$regno="";
//$comment="";

//if(isset($_REQUEST['reservationdate']))
// {
//  $reservationdate=$_REQUEST['reservationdate'];
 // $kind=$_REQUEST['kind'];
  //$regno=$_REQUEST['regno'];
  //$comment=$_REQUEST['comment'];
  
//  $whr="sold_date='00000000'";
  
//  if($reservationdate!="")
//    {$whr=$whr." and reservationdate like '%$reservationdate%'";}
    
  //if(($kind!="")&&($whr==""))
    //{$whr="kind like '%$kind%'";}
  //if(($kind!="")&&($whr!=""))
    //{$whr=$whr." and kind like '%$kind%'";}  
  //regno     
  //if(($regno!="")&&($whr==""))
    //{$whr="regno like '%$regno%'";}
  //if(($regno!="")&&($whr!=""))
    //{$whr=$whr." and regno like '%$regno%'";} 
    
  //if(($comment!="")&&($whr==""))
    //{$whr="comment like '%$comment%'";}
  //if(($comment!="")&&($whr!=""))
    //{$whr=$whr." and comment like '%$comment%'";} 
  
  //if($whr=="")
     //{$sqlMerchandise="select * from merchandise";}
//   else  
//    {$sqlReservation="select * from reservation where $whr";}
//  $qryReservationdate=mysql_query($sqlReservationdate,$conn);
  
// }
//else{$search="none";}

?>
</p>
<form name="reservation" method="post" action="queue.php">
  <p align="center"><font color="#0066FF" face="Times New Roman, Times, serif"><strong><font color="#0000FF" size="5">VIEW QUEUE LIST </font></strong></font></p>
  <table width="378" height="151" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="23" colspan="2"><p>&nbsp;</p>
        <p><font color="#660099"><strong>RESERVATION INFORMATION </strong></font></p>
        <p>&nbsp;</p></td>
    </tr>
    <tr>
      <td width="42%" height="22"><div align="right"><font color="#000000"><strong>Choose Date </strong></font></div></td>
      <td width="58%"><font face="Verdana">
        <input type=text id=reservationdate name="reservationdate" onFocus="document.reservation.button1.focus()" >
      </font></td>
    </tr>
    <tr>
      <td height="44">&nbsp;</td>
      <td><font face="Verdana">
        <input type="button" value="date" name="button12" onClick="getCalendarFor(document.reservation.reservationdate)">
        </font><font color="#FF6600"><strong>
        <input type="submit" name="Submit3" value="Go!">
      </strong></font></td>
    </tr>
    <tr>
      <td height="31">&nbsp;</td>
    </tr>
    <tr>
      <td height="31"><strong>Date : </strong></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <?
  if(isset($_REQUEST['reservationdate'])){
  ?>
  <table width="253" border="1">
    <tr>
      <td width="147"><div align="center"><strong>Time</strong></div></td>
      <td width="90"><div align="center"><strong>Status </strong></div></td>
    </tr>
	<?
	$max = 5;
	$SQL1 = "SELECT count(*) as jum FROM `MBay`.`reservation` where reservationTime = '10am-12pm' and reservationDate = '".$_REQUEST[reservationdate]."'";
    $qry1=mysql_query($SQL1,$conn);

    while($row1=mysql_fetch_array($qry1))
	      { 
		  extract($row1);  
	?>
    <tr>
      <td><strong>10:00-12:00pm</strong></td>
      <td><div align="center"><strong><font color="#006600"><? if($jum<$max){ echo "available";}else{echo "<font color='red'>not available</font>";} ?></font></strong></div></td>
    </tr>
	<?
			}
	
	$SQL2 = "SELECT count(*) as jum FROM `MBay`.`reservation` where reservationTime = '12pm-02pm' and reservationDate = '".$_REQUEST[reservationdate]."'";
    $qry2=mysql_query($SQL2,$conn);

    while($row2=mysql_fetch_array($qry2))
	      { 
		  extract($row2);  
	?>
    <tr>
      <td><strong>12:00-2:00pm</strong></td>
      <td><div align="center"><strong><font color="#006600"><? if($jum<$max){ echo "available";}else{echo "<font color='red'>not available</font>";} ?></font></strong></div></td>
    </tr>
	<?
			}
	$SQL3 = "SELECT count(*) as jum FROM `MBay`.`reservation` where reservationTime = '02pm-04pm' and reservationDate = '".$_REQUEST[reservationdate]."'";
	//$SQL3="select count(*) as jum from reservation where reservationdate='".$_REQUEST[reservationdate]."' and reservationTime='02pm-04pm'";
    $qry3=mysql_query($SQL3,$conn);

    while($row3=mysql_fetch_array($qry3))
	      { 
		  extract($row3);  
	?>
    <tr>
      <td><strong>2:00-4:00pm</strong></td>
      <td><div align="center"><strong><font color="#006600"><? if($jum<$max){ echo "available";}else{echo "<font color='red'>not available</font>";} ?></font></strong></div></td>
    </tr>
	<?
			}
	
	$SQL3 = "SELECT count(*) as jum FROM `MBay`.`reservation` where reservationTime = '04pm-06pm' and reservationDate = '".$_REQUEST[reservationdate]."'";
    $qry3=mysql_query($SQL3,$conn);

    while($row3=mysql_fetch_array($qry3))
	      { 
		  extract($row3);  
	?>
    <tr>
      <td><strong>4:00-6:00pm</strong></td>
      <td><div align="center"><strong><font color="#006600"><? if($jum<$max){ echo "available";}else{echo "<font color='red'>not available</font>";} ?></font></strong></div></td>
    </tr>
	<?
			}
	
	$SQL4 = "SELECT count(*) as jum FROM `MBay`.`reservation` where reservationTime = '06pm-08pm' and reservationDate = '".$_REQUEST[reservationdate]."'";
    $qry4=mysql_query($SQL4,$conn);

    while($row4=mysql_fetch_array($qry4))
	      { 
		  extract($row4);  
	?>
    <tr>
      <td><strong>6:00-8:00pm</strong></td>
      <td><div align="center"><strong><font color="#006600"><? if($jum<$max){ echo "available";}else{echo "<font color='red'>not available</font>";} ?></font></strong></div></td>
    </tr>
	<?
			}
	
	$SQL5 = "SELECT count(*) as jum FROM `MBay`.`reservation` where reservationTime = '06pm-08pm' and reservationDate = '".$_REQUEST[reservationdate]."'";
    $qry5=mysql_query($SQL5,$conn);

    while($row5=mysql_fetch_array($qry5))
	      { 
		  extract($row5);  
	?>
    <tr>
      <td><strong>8:00-10:00pm</strong></td>
      <td><div align="center"><font color="#006600"><strong><? if($jum<$max){ echo "available";}else{echo "<font color='red'>not available</font>";} ?></strong></font> </div></td>
    </tr>
	<?
	}
	?>
  </table>
<?
}
?>
</form>
<!-- PopUp Calendar BEGIN -->
<script language="JavaScript">
if (document.all) {
 document.writeln("<div id=\"PopUpCalendar\" style=\"position:absolute; left:0px; top:0px; z-index:7; width:200px; height:77px; overflow: visible; visibility: hidden; background-color: #FFFFFF; border: 1px none #000000\" onMouseOver=\"if(ppcTI){clearTimeout(ppcTI);ppcTI=false;}\" onMouseOut=\"ppcTI=setTimeout(\'hideCalendar()\',500)\">");
 document.writeln("<div id=\"monthSelector\" style=\"position:absolute; left:0px; top:0px; z-index:9; width:181px; height:27px; overflow: visible; visibility:inherit\">");}
else if (document.layers) {
 document.writeln("<layer id=\"PopUpCalendar\" pagex=\"0\" pagey=\"0\" width=\"200\" height=\"200\" z-index=\"100\" visibility=\"hide\" bgcolor=\"#FFFFFF\" onMouseOver=\"if(ppcTI){clearTimeout(ppcTI);ppcTI=false;}\" onMouseOut=\"ppcTI=setTimeout('hideCalendar()',500)\">");
 document.writeln("<layer id=\"monthSelector\" left=\"0\" top=\"0\" width=\"181\" height=\"27\" z-index=\"9\" visibility=\"inherit\">");}
else {
 document.writeln("<p><font color=\"#FF0000\"><b>Error ! The current browser is either too old or too modern (usind DOM document structure).</b></font></p>");}
</script>
<noscript><p><font color="#FF0000"><b>JavaScript is not activated !</b></font></p></noscript>
<table border="1" cellspacing="1" cellpadding="2" width="200" bordercolorlight="#000000" bordercolordark="#000000" vspace="0" hspace="0"><form name="ppcMonthList"><tr><td align="center" bgcolor="#CCCCCC"><a href="javascript:moveMonth('Back')" onMouseOver="window.status=' ';return true;"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><b>&lt;&nbsp;</b></font></a><font face="MS Sans Serif, sans-serif" size="1"> 
<select name="sItem" onMouseOut="if(ppcIE){window.event.cancelBubble = true;}" onChange="switchMonth(this.options[this.selectedIndex].value)" style="font-family: 'MS Sans Serif', sans-serif; font-size: 9pt"><option value="0" selected>2000 &#149; January</option><option value="1">2000 &#149; February</option><option value="2">2000 &#149; March</option><option value="3">2000 &#149; April</option><option value="4">2000 &#149; May</option><option value="5">2000 &#149; June</option><option value="6">2000 &#149; July</option><option value="7">2000 &#149; August</option><option value="8">2000 &#149; September</option><option value="9">2000 &#149; October</option><option value="10">2000 &#149; November</option><option value="11">2000 &#149; December</option><option value="0">2001 &#149; January</option></select></font><a href="javascript:moveMonth('Forward')" onMouseOver="window.status=' ';return true;"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><b>&nbsp;&gt;</b></font></a></td></tr></form></table>
<table border="1" cellspacing="1" cellpadding="2" bordercolorlight="#000000" bordercolordark="#000000" width="200" vspace="0" hspace="0"><tr align="center" bgcolor="#CCCCCC"><td width="20" bgcolor="#FFFFCC"><b><font face="MS Sans Serif, sans-serif" size="1">Su</font></b></td><td width="20"><b><font face="MS Sans Serif, sans-serif" size="1">Mo</font></b></td><td width="20"><b><font face="MS Sans Serif, sans-serif" size="1">Tu</font></b></td><td width="20"><b><font face="MS Sans Serif, sans-serif" size="1">We</font></b></td><td width="20"><b><font face="MS Sans Serif, sans-serif" size="1">Th</font></b></td><td width="20"><b><font face="MS Sans Serif, sans-serif" size="1">Fr</font></b></td><td width="20" bgcolor="#FFFFCC"><b><font face="MS Sans Serif, sans-serif" size="1">Sa</font></b></td></tr></table>

	
<script language="JavaScript">
if (document.all) {
 document.writeln("</div>");
 document.writeln("<div id=\"monthDays\" style=\"position:absolute; left:0px; top:52px; z-index:8; width:200px; height:17px; overflow: visible; visibility:inherit; background-color: #FFFFFF; border: 1px none #000000\">&nbsp;</div></div>");}
else if (document.layers) {
 document.writeln("</layer>");
 document.writeln("<layer id=\"monthDays\" left=\"0\" top=\"52\" width=\"200\" height=\"17\" z-index=\"8\" bgcolor=\"#FFFFFF\" visibility=\"inherit\">&nbsp;</layer></layer>");}
else {/*NOP*/}
</script>
<!-- PopUp Calendar END --></p>

</body>
</html>
